//package com.lb.jwitter.action.report;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.apache.struts2.ServletActionContext;
//import org.springframework.context.support.ClassPathXmlApplicationContext;
//
//import net.sf.jasperreports.engine.JasperCompileManager;
//
//import com.lb.jwitter.util.Department;
//import com.lb.jwitter.util.Person;
//import com.opensymphony.xwork2.Action;
//
//public class JasperAction {
//    /** List to use as our JasperReports dataSource. */
//    private List<Person> personList;
//	//for action
////	private EmployeeService employeeService;	
//
//    public String execute() throws Exception {
//    	
//    	Department department1 = new Department(new Long(1), "cntt");
//    	Department department2 = new Department(new Long(2), "Xay Dung");
//
//    	
//    	Person p1 = new Person(new Long(1), "Patrick", "Lightbuddie",department1);
//    	department1.getPersons().add(p1);
//    	
//        Person p2 = new Person(new Long(2), "Jason", "Carrora",department1);
//    	department1.getPersons().add(p2);
//    	
//        Person p3 = new Person(new Long(3), "Alexandru", "Papesco",department1);
//    	department1.getPersons().add(p3);
//    	
//        Person p4 = new Person(new Long(4), "Jay", "Boss",department2);
//    	department2.getPersons().add(p4);
//
//        // Store people in our dataSource list (normally would come from database).
//        personList = new ArrayList<Person>();
//        personList.add(p1);
//        personList.add(p2);
//        personList.add(p3);
//        personList.add(p4);
//
//    	
////    	 ClassPathXmlApplicationContext context
////
////		   = new ClassPathXmlApplicationContext(
////
////		                   new String[] { "beans.xml" });
////
////		        employeeService = (EmployeeService) context
////
////		                   .getBean("employeeClient");
////    	personList = employeeService.findAllEmployee(1000, 1);
////    	
////    	for(Employee d : personList){
////    		System.out.println(d.getMaNV());
////    	}      
//
//        // Normally we would provide a pre-compiled .jrxml file
//        // or check to make sure we don't compile on every request.
//
//        String templatePath = ServletActionContext.getServletContext().getRealPath("report")+"/our_jasper_template.jrxml";
//        String sourcePath = ServletActionContext.getServletContext().getRealPath("report")+"/report1.jasper";
//
//        try {
//
//            JasperCompileManager.compileReportToFile(
//                    templatePath,
//                    sourcePath);
//        } catch (Exception e) {
//            e.printStackTrace();
//            return Action.ERROR;
//          }
//
//
//        return "good";
//    }
//
//    public List<Person> getpersonList() {
//        return personList;
//    }
//
//}
